<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>修改资料 - 会员中心 - {$feifeicms.site_name}</title>
	<meta name="keywords" content="">
	<meta name="description" content="">
	{include file="block/include"}
	{include file="user/include" /}
</head>
<body>
{include file="block/head" /}
<div class="container">
    <div class="row"> 
    	<div class="col-md-wide-25 col-sm-wide-1 col-xs-1 padding-0 hidden-sm hidden-xs">
    		{include file="user/head" /}					
    	</div>
    	<div class="col-md-wide-75 col-sm-wide-1 col-xs-1 stui-pannel-side">
    		<div class="stui-pannel stui-pannel-bg clearfix">
				<div class="stui-pannel-box clearfix">
					<div class="stui-pannel_bd clearfix">
						<div class="stui-pannel_hd">
							<div class="stui-pannel__head active bottom-line clearfix">
								<h3 class="title">
									<img src="{$feifeicms.path_tpl}statics/icon/icon_30.png"/>
									我的资料
								</h3>
								<ul class="nav nav-tabs pull-right">
									<li class="hidden-xs"><a href="{:url('user/index')}">基本资料</a></li>
									<li class="active"><a href="{:url('user/info')}">修改信息</a></li>
									<li><a href="{:url('user/popedom')}">我的权限</a></li>
								</ul>
							</div>																		
						</div>
						<div class="stui-pannel_bd clearfix">
							<div class="stui-user__form col-pd clearfix">
								<form id="fm" name="fm" method="post" action="" >
									<p><span class="xiang active">用户名：</span>{$obj.user_name}</p>
									<p class="top-line-dot"><span class="xiang">原始密码：</span><input type="password" name="user_pwd" class="form-control" placeholder="原始密码"></p>
									<p class="top-line-dot"><span class="xiang">新密码：</span><input type="password" name="user_pwd1" class="form-control" placeholder="新密码"><span class="hidden-xs">不修改请留空</span></p>
									<p class="top-line-dot"><span class="xiang">重复密码：</span><input type="password" name="user_pwd2" class="form-control" placeholder="重复密码"></p>
									<p class="top-line-dot"><span class="xiang">QQ号码：</span><input type="text" name="user_qq" class="form-control" value="{$obj.user_qq}" placeholder="QQ号码"></p>
									{if condition="$obj.user_email neq ''"}
										<p class="top-line-dot"><span class="xiang">邮箱：</span><input type="text" name="user_email" class="form-control" readonly="readonly" value="{$obj.user_email}">[<a class="btn_unbind" ac="email" href="javascript:;">解绑</a>]</p>
									{else/}
										<p class="top-line-dot"><span class="xiang">邮箱：</span><input type="text" name="user_email" class="form-control" value="" placeholder="邮箱">[<a href="{:url('user/bind')}?ac=email">绑定</a>]</p>
									{/if}
				
									{if condition="$obj.user_phone neq ''"}
									<p class="top-line-dot"><span class="xiang">手机：</span><input type="text" name="user_phone" class="form-control" readonly="readonly" value="{$obj.user_phone}">[<a class="btn_unbind" ac="phone" href="javascript:;">解绑</a>]</p>
									{else/}
									<p class="top-line-dot"><span class="xiang">手机：</span><input type="text" name="user_phone" class="form-control" value="" placeholder="手机号">[<a class="btn_unbind" href="{:url('user/bind')}?ac=phone">绑定</a>]</p>
									{/if}
				
									<p class="top-line-dot"><span class="xiang">找回密码问题：</span><input type="text" name="user_question" class="form-control" value="{$obj.user_question}" placeholder="找回密码问题"></p>
									<p class="top-line-dot"><span class="xiang">找回密码答案：</span><input type="text" name="user_answer" class="form-control" value="{$obj.user_answer}" placeholder="找回密码答案"></p>
									<p class="top-line-dot"><span class="xiang"></span>
										<input type="button" id="btn_submit" class="btn btn-primary" value="保存">
										&nbsp;&nbsp;&nbsp;<a href="{:url('user/findpass')}">忘记密码了？</a>
									</p>
								</form>
							</div>																							
						</div>		
					</div>
				</div>
			</div>		
    	</div>
    </div>
</div>

<script type="text/javascript">

	$('.btn_unbind').click(function(){
		var ac = $(this).attr('ac');
		if(ac!='email' && ac!='phone'){
			alert('参数错误');
		}
		if(confirm('确认解除绑定吗？此操作不可恢复？')) {
			$.ajax({
				url: "{:url('user/unbind')}",
				type: "post",
				dataType: "json",
				data: {ac: ac},
				beforeSend: function () {
					//开启loading
				},
				success: function (r) {
					alert(r.msg);
					if(r.code==1){
						location.href="{:url('user/info')}";
					}
				},
				complete: function () {
					//结束loading
				}
			});
		}
	});

	$("#btn_submit").click(function() {
		var data = $("#fm").serialize();
		$.ajax({
			url: "{:url('user/info')}",
			type: "post",
			dataType: "json",
			data: data,
			beforeSend: function () {
				//开启loading
				//$(".loading_box").css("display","block");
				$("#btn_submit").css("background","#fd6a6a").val("loading...");
			},
			success: function (r) {
				alert(r.msg);
				if(r.code==1){
					location.href="{:url('user/info')}";
				}
			},
			complete: function () {
				//结束loading
				//$(".loading_box").css("display","none");
				$("#btn_submit").css("background","#fa4646").val("提交");
			}
		});
	});

</script>
{include file="block/foot" /}
</body>
</html>